/**
 * 角色管理主界面。Border布局，中心区是角色列表，
 * 南区是TabPanel，包含两个面板，分别是与角色关联的用户、与角色关联的菜单
 * @author linzongxue
 * @create_date 2012-1-7
 */
define(function(){
	var RoleMainPanel = Ext.extend(Ext.Panel, {
		layout: 'border',
		initComponent: function(){
		    this.roleGridPanel = cu.create('sys.role.RoleGridPanel', {region: 'center'});
            this.roleUserPanel = cu.create('sys.role.RoleUserPanel');
            this.roleMenuPanel = cu.create('sys.role.RoleMenuPanel');
			this.items = [
			    this.roleGridPanel,
			    this.tabPanel = new Ext.TabPanel({
					region: 'south', 
			        collapsible: false,
			        collapseMode: 'mini',
			        split: true,
			        border: false,
			        height: au.getMainPanel().getHeight()/2, 
			        activeTab: 0,
			        items:[this.roleMenuPanel, this.roleUserPanel]
			    })
			];
			RoleMainPanel.superclass.initComponent.call(this);
		},
		changeRole: function(role){
			this.tabPanel.items.each(function(panel){
				panel.setRole(role);
				if (panel.isVisible()) panel.refresh();
			});
		}
	});
	return RoleMainPanel;
});